package paint;


public abstract class WorldVector {

	protected static final int X_INDEX = 0;
	protected static final int Y_INDEX = 1;
	protected static final int Z_INDEX = 2;
	protected static final int W_INDEX = 3;

	protected double[] vector;
	
	public double getX() {
		if(vector != null && vector.length > X_INDEX) {
			return vector[X_INDEX];
		}
		return 0.0;
	}
	
	public double getY() {
		if(vector != null && vector.length > Y_INDEX) {
			return vector[Y_INDEX];
		}
		return 0.0;
	}
	
	public double getZ() {
		if(vector != null && vector.length > Z_INDEX) {
			return vector[Z_INDEX];
		}
		return 0.0;
	}
	
	public void setX(double x) {
		if(vector != null && vector.length > X_INDEX) {
			vector[X_INDEX] = x;
		}
	}

	public void setY(double y) {
		if(vector != null && vector.length > Y_INDEX) {
			vector[Y_INDEX] = y;
		}
	}
	
	public void setZ(double z) {
		if(vector != null && vector.length > Z_INDEX) {
			vector[Z_INDEX] = z;
		}
	}
	
	@Override
	public abstract String toString();
	
}
